package com.bwie.controller;

import com.bwie.service.PictureService;
import com.bwie.utils.R;
import com.bwie.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;


@RestController
@RequestMapping("/file/upload")
public class PictureController {

    @Autowired
    PictureService pictureService;



    @PostMapping("/uploadImage")
    public Result uploadImage(@RequestPart("file")MultipartFile file){

      String url= String.valueOf(pictureService.uploadImage(file));
        return Result.ok().setData(url);
    }


}
